IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CfgCtrl]') AND type in (N'U'))
BEGIN
     DROP TABLE dbo.CfgCtrl
END
GO

CREATE TABLE dbo.CfgCtrl(
     CfgCtrlKey         varchar(30)   NOT NULL,
     CfgCtrlValue       varchar(8000)     NULL,
     CfgCtrlDescription varchar(128)  NOT NULL,
     LastModDt          datetime      NOT NULL DEFAULT (getdate()),
     CONSTRAINT [PK_CfgCtrl] PRIMARY KEY CLUSTERED ( CfgCtrlKey ASC )
)
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Unique Idenitifier of a particular Configuration Control Key.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CfgCtrl', @level2type=N'COLUMN',@level2name=N'CfgCtrlKey'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Value of the configuration control key.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CfgCtrl', @level2type=N'COLUMN',@level2name=N'CfgCtrlValue'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'User-friendly description of the configuration control key.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CfgCtrl', @level2type=N'COLUMN',@level2name=N'CfgCtrlDescription'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'The last date/time the record was changed.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CfgCtrl', @level2type=N'COLUMN',@level2name=N'LastModDt'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Database level configuration control data.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CfgCtrl'
GO
